﻿using csLTDMC;
using InspectionMAC.Forms;
using InspectionMAC.Function;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace InspectionMAC.SystemThread
{
    class RecordLocationThread02
    {
        public static bool RecordLocation_Flowrec = false;
        public static Thread RecordLocationFlow_Thread = null;
        public static int iRecordLocation_Step = 0;

        public static bool RecordLocation_Stop = false;

        public static DateTime triggerDataTime;
        public static void RecordLocation_Thread()
        {
            RecordLocation_Flowrec = true;
            RecordLocationFlow_Thread = new Thread(RecordLocationFlowThread);
            RecordLocationFlow_Thread.IsBackground = true;
            RecordLocationFlow_Thread.Start();
        }
        private static void RecordLocationFlowThread(object obj)
        {
            while (RecordLocation_Flowrec)
            {
                switch (iRecordLocation_Step)
                {
                    case 0:

                        break;

                    case 10:
                        if (DIO_Thread.Di[12] == 1)
                        {
                            triggerDataTime = DateTime.Now;
                            UInt32 nEnPos = LTDMC.dmc_get_encoder(DMC300_Info.usCardId[0], 2);
                            LTDMC.dmc_compare_add_point(
                    DMC300_Info.usCardId[0], // 控制卡ID
                    2,                       // 轴号 (轴2)
                    75762,                 // 触发位置
                    1,                       // 模式
                    5,        // 动作类型
                    10              // DO引脚
                );
                            iRecordLocation_Step = 15;
                        }
                        break;
                    case 15:

                        break;
                    case 20:

                        break;
                    case 25:

                        break;
                    case 30:

                        break;
                    case 35:

                        break;
                }
            }
        }
    }
}
